import {Suspense} from 'react'
import { BrowserRouter,Route,Routes } from "react-router-dom";
import routerList from './router/index';
import IsRoute from './router/isRoute';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const renderRouter=(list: any)=>{
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  return list.map((item:any)=>{
    return <Route path={item.path} element={item.tokens?<IsRoute aa={item.element}></IsRoute>:<item.element></item.element>} key={item.path}>
       {item.children&&renderRouter(item.children)}
    </Route>
  })
}
const App = () => {
  return (
    <div>
       <Suspense fallback={<div>...loading</div>}>
         <BrowserRouter>
            <Routes>
               {renderRouter(routerList)}
            </Routes>
          </BrowserRouter>
       </Suspense>
    </div>
  )
}
export default App
